package com.wzh.design.proxy.proxy2;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @description: 动态代理
 * @author: WZH
 * @time: 2021/6/9 14:22
 */
public class DynamicProxyHandler implements InvocationHandler {

    private Object object;

    public DynamicProxyHandler (final Object object){
        this.object = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("买房准备前");
        Object result = method.invoke(object, args);
        System.out.println("买房装修后");
        return result;
    }
}







